package fatworm.parser.syntree;
/**
 * syntax query delete from table where
 */
public class DeleteTableNode extends QueryNode{
	public String 	 tableName;
	public WhereNode where = null;
	
	public DeleteTableNode( String tableName , WhereNode where ){
		this.tableName = tableName; this.where = where;
	}
	public DeleteTableNode( String tableName ){
		this( tableName , null );
	}
	
	public boolean deleteAll(){
		return where == null;
	}
	
	public void accept(IQueryVisitor visitor){
		visitor.visit( this );
	}
	public String toString() {
		return "DROP FROM " + tableName + (this.deleteAll()?"":" WHERE "+where);
	}
}
